﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LinqToLdap;
using System.Configuration;

namespace LINQtoLDAPDemo_Setup
{
    class ContainerMapping : LinqToLdap.Mapping.ClassMap<Container>
    {
        //public ContainerMapping()
        //{
        //    NamingContext(string.Format("{0}", ConfigurationSettings.AppSettings["ldapPartition"]));
        //    ObjectCategory("container");

        //    DistinguishedName(e => e.DistinguishedName);
        //    Map(e => e.CN); // throws off Update command when adding management DNs
        //}

        public override LinqToLdap.Mapping.IClassMap PerformMapping(string namingContext = null, string objectCategory = null, 
            bool includeObjectCategory = true, IEnumerable<string> objectClasses = null, bool includeObjectClasses = true)
        {
            NamingContext(string.Format("{0}", ConfigurationSettings.AppSettings["ldapPartition"]));
            ObjectCategory("container");

            DistinguishedName(e => e.DistinguishedName);
            Map(e => e.CN); // throws off Update command when adding management DNs
            //throw new NotImplementedException();

            return this;
        }
    }
}
